<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%String path = request.getContextPath();%>
<script type="text/javascript">
function submitCostListForm(form){
	if('${searchType}'=='')
		return navTabSearch(form);
	else
	    return dwzSearch(form, 'dialog');
}
</script>
<form id="pagerForm" method="post" action="<%=path %>/cost/listCost.action">
	<input type="hidden" name="pageRequest" value="1" />
	<input type="hidden" name="pageNum" value="${paginator.pageIndex}" />
	<input type="hidden" name="numPerPage" value="${paginator.pageSize}" />
</form>

<div class="pageHeader">
	<form onsubmit="return submitCostListForm(this);" rel="pagerForm" action="<%=path %>/cost/listCost.action" method="post">
	<input type="hidden" name="searchType" value="${searchType}"/>
	<input type="hidden" name="costVO.cardEntity.id" value="${costVO.cardEntity.id}"/>
	<div class="searchBar">
		<c:if test="${searchType==null}">
		<ul class="searchContent">
				<li>
					<label style="text-align: right;">会员卡：</label>
					<input name="costVO.memberCardId" value="<s:property value="costVO.memberCardId" />" type="hidden">
					<input onclick="$('#costList_a_btnLook1').trigger('click');" style="cursor: pointer;float: left;" name="costVO.memberName" value="<s:property value="costVO.memberName" />" >
					<!-- <a class="btnLook" id="costList_a_btnLook1" href="<%=path %>/memberCard/listMemberCard.action?searchType=lookup" lookupGroup="costVO">选择</a> -->
				</li>
				<li>
					<label style="text-align: right;">会员卡号：</label>
					<input onclick="$('#costList_a_btnLook2').trigger('click');" style="cursor: pointer;float: left;" name="costVO.memberCode" value="<s:property value="costVO.memberCode" />" >
					<!-- <a class="btnLook" id="costList_a_btnLook2" href="<%=path %>/memberCard/listMemberCard.action?searchType=lookup" lookupGroup="costVO">选择</a> -->
				</li>
				<li>
					<label style="text-align: right;">操作人：</label>
					<input name="costVO.operatorId" value="<s:property value="costVO.operatorId" />" type="hidden">
					<input onclick="$('#costList_a_btnLook3').trigger('click');" style="cursor: pointer;float: left;" name="costVO.operatorName" value="<s:property value="costVO.operatorName" />" >
					<!-- <a class="btnLook" id="costList_a_btnLook3" href="<%=path %>/user/listUser.action?searchType=lookup" lookupGroup="costVO">选择</a> -->
				</li>
			</ul>
			</c:if>
			<ul class="searchContent">
				<li>
					<label style="text-align: right;">消费类型：</label>
					<select name="costVO.type" class="combox">
                        <option value="">==选择类型==</option>
                        <c:forEach var="item" items="${costTypes}">
                        	<option value="${item.name}" ${costVO.type eq item.name ? "selected" : "" }>${item.title}</option>
                        </c:forEach>
                   </select>
				</li>
				<c:if test="${searchType==null}">
				<li>
					<label style="text-align: right;">商品：</label>
					<input name="costVO.productId" value="<s:property value="costVO.productId" />" type="hidden">
					<input onclick="$('#costList_a_btnLook4').trigger('click');" style="cursor: pointer;float: left;" name="costVO.productName" value="<s:property value="costVO.productName" />"/>
					<!-- <a class="btnLook" id="costList_a_btnLook4" href="<%=path %>/product/listProduct.action?searchType=lookup" lookupGroup="costVO">选择</a> -->
				</li>
				</c:if>
				<c:choose>
				<c:when test="${SESSION_USER.customer==null}">
					<input name="costVO.customerId" value="${costVO.customerId}" type="hidden">
					<c:if test="${searchType==null||searchType==''}">
						<li>
							<label style="text-align: right;">所属商家：</label>
						<input onclick="$('#costList_a_btnLook5').trigger('click');" style="cursor: pointer;float: left;" name="costVO.customerName" value="<s:property value="costVO.customerName" />"/>
						<!-- <a class="btnLook" id="costList_a_btnLook5" href="<%=path %>/customer/listCustomer.action?searchType=favourableEntity" lookupGroup="costVO">选择</a>-->
						</li>
					</c:if>
				</c:when>
				<c:otherwise>
					<input name="costVO.customerId" value="${SESSION_USER.customer.id}" type="hidden">
				</c:otherwise>
				</c:choose>
				<li>
					<label style="text-align: right;">消费金额：</label>
					大于<input type="text" name="costVO.gtmoney" value="${costVO.gtmoney}" class="number" size="5"/>
					小于<input type="text" name="costVO.ltmoney" value="${costVO.ltmoney}" class="number" size="5"/>
				</li>
			</ul>
			<ul  class="searchContent">
				<li>
					<label style="text-align: right;">积分次数：</label>
					大于<input type="text" name="costVO.gtscore" value="${costVO.gtscore}" class="number" size="5"/>
					小于<input type="text" name="costVO.ltscore" value="${costVO.ltscore}" class="number" size="5"/>
				</li>
				<li style="width: 450px">
					<label style="text-align: right;">消费时间段：</label>
					大于<input type="text" name="costVO.gtcostDate" value="${costVO.gtcostDateStr}" dateFmt="yyyy-MM-dd HH:mm:ss" class="date" readonly="false" size="19"/>
					小于<input type="text" name="costVO.ltcostDate" value="${costVO.ltcostDateStr}" dateFmt="yyyy-MM-dd HH:mm:ss" class="date" readonly="false" size="19"/>
				</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<!-- 
			<li><a class="add" href="<%=path %>/cost/addCost.action" target="navTab"><span>添加</span></a></li>
			
			 <shiro:hasPermission name="deleteCost">
			<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="key" postType="string" href="<%=path %>/cost/deleteCost.action" class="delete"><span>删除</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="editCost">
			<li><a class="edit" href="<%=path %>/cost/editCost.action?costVO.id={sid_user}" target="navTab" warn="请选择一条记录"><span>修改</span></a></li>
			</shiro:hasPermission> -->
		</ul>
	</div>
	<table class="table" width="1150" layoutH="189">
		<thead>
			<tr>
				<!--<th width="30"><input type="checkbox" group="ids" class="checkboxCtrl"></th>-->
				<th>会员卡</th>
				<th>会员卡号</th>
				<th>商家</th>
				<th>消费金额</th>
				<th>消费类型</th>
				<th>积分/次数</th>
				<th>操作人</th>
				<th>商品</th>
				<th>说明</th>
				<th>消费时间</th>
				<th width="70">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="costList" id="cost" status="st">
				<tr target="sid_user" rel="<s:property value="id" />">
					<!--<td><input name="key" value="<s:property value="id" />" type="checkbox"></td>-->
             <td><s:property value="cardEntity.memberName" /></td>
             <td><s:property value="cardEntity.schemeCode" /></td>
             <td><s:property value="customer.name" /></td>
             <td><s:property value="money" /></td>
             <td>
             	<c:forEach items="${costTypes}" var="t">
             		<c:if test="${t.name == type}">
             			${t.title}
             		</c:if>
             	</c:forEach>
			</td>
             <td><s:property value="score" /></td>
             <td><s:property value="operator.name" /></td>
             <td><s:property value="product.name" /></td>
             <td><s:property value="description" /></td>	
			<td><s:date name="costDate" format="yyyy-MM-dd HH:mm:ss" /></td>
			<td>
				<c:if test="${searchType == 'lookup'}">
					<a class="btnSelect" href="javascript:$.bringBack({money:'${money}', score:'${score}'});" title="查找带回">选择</a>
				</c:if>
					<!-- 
						<shiro:hasPermission name="deleteCost">
						<a title="确实要删除这条记录吗?" target="ajaxTodo" href="<%=path %>/cost/deleteCost.action?key=<s:property value="id" />" class="btnDel">删除</a>
						</shiro:hasPermission>
						<shiro:hasPermission name="editCost">
						<a title="编辑" target="navTab" href="<%=path %>/cost/editCost.action?costVO.id=<s:property value="id" />" class="btnEdit">编辑</a>
						</shiro:hasPermission>
						 -->
			</td>
		</tr>
		</s:iterator>
	</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
				<span>显示</span>
				<select class="combox" name="numPerPage" onchange='<s:if test="%{searchType==null||searchType==''}">navTabPageBreak({numPerPage:this.value})</s:if><s:else>dialogPageBreak({numPerPage:this.value})</s:else>'>
					<option value="15" <c:if test="${paginator.pageSize==15}">selected='selected'</c:if> >15</option>
					<option value="30" <c:if test="${paginator.pageSize==30}">selected='selected'</c:if> >30</option>
					<option value="50" <c:if test="${paginator.pageSize==50}">selected='selected'</c:if> >50</option>
					<option value="100" <c:if test="${paginator.pageSize==100}">selected='selected'</c:if> >100</option>
					<option value="200" <c:if test="${paginator.pageSize==200}">selected='selected'</c:if> >200</option>
				</select>
				<span>条，共${paginator.totalCount}条</span>
			</div>
			<div class="pagination" targetType="${(searchType==null||searchType=='')?'navTab':'dialog'}" totalCount="${paginator.totalCount}" 
				numPerPage="${paginator.pageSize}" pageNumShown="10" currentPage="${paginator.pageIndex}"></div>
	</div>
</div>